<template>
  <div>
    <el-container>
      <el-header height="70px">
        <p class="header_title">编辑账号</p>
        <!--  -->
        <el-breadcrumb separator="/">
          <el-breadcrumb-item>权限维护</el-breadcrumb-item>
          <el-breadcrumb-item>账户管理</el-breadcrumb-item>
          <el-breadcrumb-item>编辑账号</el-breadcrumb-item>
          <el-breadcrumb-item></el-breadcrumb-item>
        </el-breadcrumb>
      </el-header>

      <el-main>
        <el-card class="box-card">
          <div slot="header">
            <span>编辑账号信息</span>
          </div>

          <!--  -->
          <!-- 0 -->
          <el-row :gutter="200">
            <el-col :span="10">
              <p class="hasList">已经分配角色列表</p>
              <el-table :data="rolelist" border stripe>
                <el-table-column label="名称" prop="alias"></el-table-column>
                <el-table-column label="操作">
                  <template slot-scope="scope">
                    <el-button type="primary" size="mini">取消</el-button>
                  </template>
                </el-table-column>
              </el-table>
            </el-col>


            <el-col :span="14">
              <el-row>
                 <!--搜索框  -->
                <el-col>
                  <el-input
                    placeholder="根据名称查询"
                    clearable
                    class="searchIcon"
                  >
                    <el-button
                      slot="append"
                      icon="el-icon-search"
                    ></el-button>
                  </el-input>
                </el-col>

                <!-- 页数展示 -->
                <el-col>
                  <p class="notList">行为列表</p>
                  <span>
                    <el-pagination
                      @size-change="handleSizeChange"
                      @current-change="handleCurrentChange"
                      :page-sizes="[1, 3, 5, 10]"
                      :page-size="pagination.pagesize"
                      layout=" sizes,total"
                      :total="pagination.total"
                    >
                    </el-pagination>
                  </span>
                </el-col>
              </el-row>

              <el-table :data="pagelist"  border stripe >
                <el-table-column
                  label="名称"
                  prop="alias"
                  width="300px"
                  height="20px"
                ></el-table-column>
                <el-table-column label="操作">
                  <el-button type="primary" size="mini">分配</el-button>
                </el-table-column>
              </el-table>

               <el-pagination
                @size-change="handleSizeChange"
                @current-change="handleCurrentChange"
                :current-page="pagination.pagenum"
                :page-size="pagination.pagesize"
                background
                layout="prev, pager, next"
                :total="pagination.total"
              >
              </el-pagination>
        
            </el-col>

          </el-row>
        </el-card>
      </el-main>
    </el-container>
  </div>
</template>

<script>
export default {
  data() {
    return {
        notRoleInfo:{
            roleList:'',
            total:3
        },
        // 
        pagination:{
            uid:1,
            pagenum:1,
            pagesize:3
        },
        pagelist:[],
        // 
        RoleInfo:{
            role:''
        },
        RoleData:{
            uid:'1'
        },
        rolelist:[],
        
    };
  },
  methods: {
    // /userRole/select/notRole
    async notRoleList(){
        const res = await this.http.get('/userRole/select/notRole',this.pagination)
        this.pagelist = res.roleList
        this.pagination.total = res.total
    },
     handleSizeChange(newSize) {
      this.pagination.pagesize = newSize;
      this.notRoleList()
    },
    handleCurrentChange(newPage) {
      this.pagination.pagenum = newPage;
      this.notRoleList()
    },
    async hasRoleList(){
        const {res} = await this.http.post('/userRole/select/has',this.RoleData)
        this.roleList = res
        console.log(res);
        console.log();
    }

  },
  created() {
      this.notRoleList()
      this.hasRoleList()
  }
};
</script>

<style scoped>
.hasList {
  border-bottom: 5px solid yellow;
  width: 140px;
}
.notList {
  border-bottom: 5px solid lightgreen;
  width: 80px;
}
/* 搜索框 */
.searchIcon{
  width: 300px;
}
</style>
